package com.qaml.mes.device.enums;


import java.util.Arrays;

/**
 * @ClassName OrderHandleStatusEnum
 * @Description 任务单处理状态
 * @Author leikai
 * @Date 2023/10/25 15:36
 * @Version 1.0
 */
public enum OrderHandleStatusEnum {

    NO_START(0, "待开始"),
    HANDLING(10, "处理中"),
    HANDLING_NORMAL(20, "处理正常"),
    HANDLING_EXCEPTION(30, "处理异常"),
    RECHECK(40, "复核中"),
    RECHECK_NORMAL(50, "复核通过"),
    RECHECK_EXCEPTION(60, "复核不通过"),
    ;

    /**
     * 类型
     */
    private Integer type;
    /**
     * 描述
     */
    private String desc;

    OrderHandleStatusEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public String getDesc() {
        return desc;
    }

    public static OrderHandleStatusEnum ofType(Integer type) {
        if (null == type) {
            return null;
        }
        return Arrays.stream(values()).filter(orderHandleStatusEnum -> type.equals(orderHandleStatusEnum.getType())).findFirst().orElse(null);
    }
}